Skip to content

Don't collect headers and macros from dependencies transitively#98

Merged
chrisnovakovic merged 1 commit intoplease-build:masterfrom
chrisnovakovic:relaxed-transitivity
Nov 28, 2025
Merged

Don't collect headers and macros from dependencies transitively#98
chrisnovakovic merged 1 commit intoplease-build:masterfrom
chrisnovakovic:relaxed-transitivity

Conversation

@chrisnovakovic
Copy link
Contributor

@chrisnovakovic chrisnovakovic commented Nov 28, 2025

Header files and macro definitions are currently collected from dependencies transitively, which is too aggressive. The only headers required to compile a C/C++ source file are the ones included by that source file, and the only macros that should be defined on the command line are the ones necessary to compile that source file. Collecting headers transitively pollutes the build environment (and increases the probability of unnecessary header name clashes); collecting macro definitions transitively risks causing action at a distance, especially for macros that change the visibility or behaviour of functions defined in the standard library (e.g. _XOPEN_SOURCE).

Only collect headers exposed by direct dependencies, and don't collect macro definitions from dependencies at all.

Fixes #95.

…ncies

Header files and macro definitions are currently collected from
dependencies transitively, which is too aggressive. The only headers
required to compile a C/C++ source file are the ones included by that
source file, and the only macros that should be defined on the command
line are the ones necessary to compile that source file. Collecting
headers transitively pollutes the build environment (and increases the
probability of unnecessary header name clashes); collecting macro
definitions transitively risks causing action at a distance, especially
for macros that change the meaning or behaviour of functions defined in
the standard library (e.g. `_XOPEN_SOURCE`).

Only collect headers exposed by direct dependencies, and don't collect
macro definitions from dependencies at all.

Fixes please-build#95.
@chrisnovakovic chrisnovakovic merged commit c355aad into please-build:master Nov 28, 2025
28 checks passed
@chrisnovakovic chrisnovakovic deleted the relaxed-transitivity branch November 28, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transitivity is too aggressive for cc_library and friends

2 participants